package com.suse.service.vod.controller;

import com.suse.common.config.response.R;
import com.suse.service.vod.service.VideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Api(tags = "视频接口")
@RestController
@RequestMapping("/vod/video")
public class VideoController {

    @Resource
    private VideoService videoService;

    @ApiOperation(value = "上传视频")
    @PostMapping("/upload")
    public R uploadVideo(MultipartFile file) {
        return videoService.uploadVideo(file);
    }

    @ApiOperation(value = "获取视频播放凭证")
    @GetMapping("/play-auth/{vid}")
    public R playVideo(@PathVariable(value = "vid") String vid) {
        return videoService.playVideo(vid);
    }

}
